// drag provider
import React, { useRef } from 'react';
import { DndProvider, createDndContext } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';

const DragProvider = ( props: any ) => {
	const RNDContext = createDndContext( HTML5Backend );
	const manager = useRef( RNDContext );

	const { children } = props;

	return (
		<>

			<DndProvider manager={manager.current.dragDropManager}>
				{children && children}
			</DndProvider>
		</>
	);
};

export default React.memo( DragProvider );
